package com.wlw.eye.mvp.presenter

import android.content.Context
import com.wlw.eye.mvp.contract.HotContract
import com.wlw.eye.mvp.model.HotModel
import com.wlw.eye.utils.applyScheduler

class HotPresenter(context: Context, view: HotContract.View) : HotContract.Presenter {
    var mContext: Context? = null
    var mView: HotContract.View? = null
    val mModel by lazy {
        HotModel()
    }

    init {
        mContext = context
        mView = view
    }

    override fun requestData(strategy: String) {
        var observable = mContext?.let { mModel.loadData(it, strategy) }
        observable?.applyScheduler()?.subscribe {
            mView?.setData(it)
        }
    }

    override fun start() {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

}